<!-- 款项信息 -->
<template>
	<view>
		<view class="list_box" @touchstart="touchShow = false" @click="touchShow =false" @touchmove="touchShow = false">
			<view class="oyher_top">应收款信息</view>
			<moneyInformationItem :dataSource="dataSource"></moneyInformationItem>
		</view>
	</view>
</template>

<script>
	import http from '@/utils/request/index.js'
	import specialHttp from '@/utils/request/specialIndex' // 特殊请求方式，直接返回res
	import address from '@/utils/address.js'
	import fileList from '@/pages/synergy/components/fileList.vue'
	import moneyInformationItem from './moneyInformationItem.vue'
	export default {
		props: {
			projectId: {
				type: [String, Number],
				default: '',
			}
		},
		components: {
			fileList,
			moneyInformationItem, // 款项信息
		},
		watch: {
			projectId: {
				handler (val) {
					if (val) {
						this.loadDataByProjectId(val)	// 获取详情
					}
				},
				immediate: true
			}
		},
		data() {
			return {
				address,
				dataSource: []
			}
		},
		methods: {
			
			// 获取投标信息
			async loadDataByProjectId(val) {
				await this.ininClearData();
				var params = await {
					projectId: val,
					column: '',
					order: ''
				}
				http.get('/api/erp/project/report/erpProjectContractReport/queryCollectPaymentList', params).then(async (res) => {
					if (res.success) {
						this.dataSource = await res.result || res.result.records;
					}
				})
			},
			ininClearData() {
				this.dataSource = []
			},
			// 地址显示
			getAddress(areaCode) {
			  var arr = areaCode.split(',')
			  var addressDetail = ''
			  this.address.map((value) => {
			    if (arr[0] && value.code == arr[0]) {
			      addressDetail = value.name
			      value.children.map((val) => {
			        if (arr[1] && val.code == arr[1]) {
			          addressDetail = addressDetail + val.name
			          val.children.map((item) => {
			            if (arr[2] && item.code == arr[2]) {
			              addressDetail = addressDetail + item.name
			            }
			          })
			        }
			      })
			    }
			  })
			  return addressDetail
			},
		}
	}
</script>

<style lang="less" scoped>
@import url("@/assets/projectStyle.less");
</style>